package com.ruoyi.bill.service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.ruoyi.bill.domain.*;
import com.ruoyi.common.core.domain.AjaxResult;

import javax.servlet.http.HttpServletResponse;

/**
 * 单据管理Service接口
 *
 * @author nexiaozi
 * @date 2022-02-19
 */
public interface IZnDepotHeadService
{
    /**
     * 查询单据管理
     *
     * @param id 单据管理主键
     * @return 单据管理
     */
    public ZnDepotHead selectZnDepotHeadById(Long id);

    /**
     * 查询单据管理列表
     *
     * @param znDepotHead 单据管理
     * @return 单据管理集合
     */
    public List<ZnDepotHead> selectZnDepotHeadList(ZnDepotHead znDepotHead);

    /**
     * 新增单据管理
     *
     * @param znDepotHead 单据管理
     * @return 结果
     */
    public int insertZnDepotHead(ZnDepotHead znDepotHead);

    /**
     * 修改单据管理
     *
     * @param znDepotHead 单据管理
     * @return 结果
     */
    public int updateZnDepotHead(ZnDepotHead znDepotHead);

    /**
     * 批量删除单据管理
     *
     * @param ids 需要删除的单据管理主键集合
     * @return 结果
     */
    public int deleteZnDepotHeadByIds(Long[] ids);

    /**
     * 删除单据管理信息
     *
     * @param id 单据管理主键
     * @return 结果
     */
    public int deleteZnDepotHeadById(Long id);

    /**
     * 获取单据编号
     * @param  type 1 零售 2销售 3 采购
     */
    public String getBillNo(String type);
    /**
     * 修改单据信息状态
     * @param status 状态 1 审核 0 反审核
     * @param ids 单据主键
     * @author nexiaozi
     * @date 2022年2月20日
     */
    public int changeStatus(Long[] ids, String status);

    List<DepotItemVo4WithInfoEx> selectZnDepotHeadPage(String orderType,String materialParam, String startTime, String endTime);

    BigDecimal buyOrSale(String type, String subType, Long mId, Long materialExtendId, String monthTime, String number);

    List<DepotHeadVo4InDetail> findByAll(String beginTime, String endTime, String type, String materialParam, List<Long> depotList, Long organId, String number,String status);

    List<DepotHeadVo4InDetail> findAllocationDetail(String beginTime, String endTime, String subType, String number, String materialParam, List<Long> depotList, List<Long> depotFList);

    List<DepotHeadVo4InOutMCount> findInOutMaterialCount(String beginTime, String endTime, String type, String materialParam, List<Long> depotList, Long oId);

    List<DepotItemVo4WithInfoEx> findInOutStockReport(String toNull, String timeB);

    BigDecimal getStockByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime);

    Map<String, BigDecimal> getIntervalMapByParamWithDepotList(List<Long> depotList, Long mId, String timeA, String timeB);

    List<DepotHeadVo4StatementAccount> findStatementAccount(String beginTime, String endTime, Long organId, String supType);

    BigDecimal findTotalPay(Long organId, String beginTime, String supType);
    public BigDecimal allMoney(String getS, String type, String subType, String mode, String endTime);
    public BigDecimal findAllMoney(Long supplierId, String type, String subType, String mode, String endTime);

    List<DepotItemStockWarningCount> findStockWarningCount(String materialParam, List<Long> depotList);

    List<DepotItemVo4DetailByTypeAndMId> findDetailByTypeAndMaterialIdList(Map<String, String> parameterMap);


    List<ZnDepotItem> selectZnDepotItemByHeadId(Long id);

    List<DepotHeadVo4List> getDetailByNumber(String billNo) throws Exception;

    List<DepotItemVo4WithInfoEx> getDetailList(Long headerId);

    BigDecimal getSkuStockByParam(Long depotId, Long materialExtendId, String o, String o1);

    BigDecimal getStockByParam(Long depotId, Long materialId, String o, String o1);

    BigDecimal getFinishNumber(Long materialId, Long headerId);

    List<ZnDepotHead> selectZnDepotHeadDebtList(ZnDepotHead znDepotHead);

    List<ZnDepotItemExportTemplate> selectExportZnDepotItemByHeadId(Long id);

    List<ZnDepotItemExportTemplate> selectExportZnDepotItemByHeadIds(List<Long> headIds);

    /**
     * 订单信息导出
     * @param znDepotHead
     */
    void exportOrder(HttpServletResponse response, ZnDepotHead znDepotHead);
    /**
     * 单据统计数据
     * @param type 0 今天 1 本月
     * @return
     */
    Map<String,Object> selectReport(int type);

    /**
     * 近六个月单据统计数据
     * @author nexiaozi
     * @date 2022年9月14日
     */
    List<Map<String, Object>> selectLastSixMonthReport();

    int selectZnDepotHeadCount(ZnDepotHead queryParam);
    /**
     * 每天进行一次库存查询比对，不正确的记录下来
     */
    void stockTask();
    /**
     * 每天进行一次单据查询比对，异常的记录下来
     */
    void billTask();
}
